package com.su.kddq.controller.courier;

import com.su.kddq.service.user.OrderService;
import com.su.kddq.utils.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 发送完整的订单列表（接单大厅）
 * TODO 后面要分页、调度优化
 *
 * @author sx
 */
@RestController
@RequestMapping("/hddq/express/h5/courier/send/")
public class SendFulOrderList {

    @Autowired
    private OrderService orderService;

    /**
     * 抢单大厅列表
     *
     * @param map
     * @return
     */
    @PostMapping({"list"})
    @PreAuthorize("hasAuthority(2)")
    public R list(@RequestBody Map map) {
        Map mapInfo = new HashMap();
        boolean isStart = (Boolean) map.get("istart");
        if (isStart) {
            mapInfo = orderService.getOrderListNoPage(map);
        }

        return R.ok().data("mapInfo", mapInfo);
    }

}
